package com.nts.visionworks.core.security.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * SecurityGroup generated by hbm2java
 */
@Entity
@Table(name = "security_group", catalog = "visionworks", uniqueConstraints = @UniqueConstraint(columnNames = "GroupName"))
public class SecurityGroup implements java.io.Serializable
{

	private Integer groupId;
	private int parentId;
	private String groupName;
	private Set<SecurityIdentity> securityIdentities = new HashSet<SecurityIdentity>(
			0);

	public SecurityGroup()
	{
	}

	public SecurityGroup(int parentId, String groupName)
	{
		this.parentId = parentId;
		this.groupName = groupName;
	}

	public SecurityGroup(int parentId, String groupName,
			Set<SecurityIdentity> securityIdentities)
	{
		this.parentId = parentId;
		this.groupName = groupName;
		this.securityIdentities = securityIdentities;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "GroupId", unique = true, nullable = false)
	public Integer getGroupId()
	{
		return this.groupId;
	}

	public void setGroupId(Integer groupId)
	{
		this.groupId = groupId;
	}

	@Column(name = "ParentId", nullable = false)
	public int getParentId()
	{
		return this.parentId;
	}

	public void setParentId(int parentId)
	{
		this.parentId = parentId;
	}

	@NotNull(message = "validation.securityGroup.groupName.notNull")
	@Size(message = "validation.securityGroup.groupName.length", max = 50, min = 1)
	@Column(name = "GroupName", unique = true, nullable = false, length = 50)
	public String getGroupName()
	{
		return this.groupName;
	}

	public void setGroupName(String groupName)
	{
		this.groupName = groupName;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "securityGroups")
	public Set<SecurityIdentity> getSecurityIdentities()
	{
		return this.securityIdentities;
	}

	public void setSecurityIdentities(Set<SecurityIdentity> securityIdentities)
	{
		this.securityIdentities = securityIdentities;
	}

}
